﻿
using System.Collections.Generic;

namespace LxCFD
{
    public class DistanceGroup : UnitGroupBase<DistanceUnit>
    {
        public List<WallDistance> distanceInZone = new List<WallDistance>();
        public List<ConnectHeadBase> distanceInContact = new List<ConnectHeadBase>();
        public override void Rearrange(ConnectivityAnalysis connectivityAnalysis)
        {
            Units = new List<DistanceUnit>();
            var list = connectivityAnalysis.SplitByConnectivity(distanceInZone, distanceInContact);
            foreach (var l in list)
            {
                DistanceUnit u = new DistanceUnit();
                u.Initialize(l.Zones, l.Contacts);
                Units.Add(u);
            }
            distanceInZone.Clear();
            distanceInContact.Clear();
        }
    }
}
//Units = TempStor.SplitByConnectivity(connectivityAnalysis);
//TempStor = null;
//public DistancePDEUnit TempStor { get; set; }
//public override void Clear()
//{
//    base.Clear();
//    TempStor = new DistancePDEUnit();
//}
//Units = new List<DistancePDEUnit>();
//var pools = connectivityAnalysis.Analysis(TempStor.DistanceInZone, TempStor.DistanceInContact);
//foreach (var p in pools)
//{
//    DistancePDEUnit u = new DistancePDEUnit();
//    foreach (int z in p.zonesIndex)
//    {
//        u.AddWallDis(TempStor.DistanceInZone[z]);
//    }
//    foreach (int c in p.contactsIndex)
//    {
//        u.AddWallDis(TempStor.DistanceInContact[c]);
//    }
//    Units.Add(u);
//}